Repository navigation
feat(client-generator): send the SDK usage event as the cli-otel CloudEvent - #3371
Conversation
🦋 Changeset detectedLatest commit: 13ef351 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 Recheck Summary
📋 Findings by rule🟡 technical-english/sentence-length: 0 errors, 2 warnings, 0 info Errors fail the full-tree check. Warnings and info are a worklist and do not block the PR. 📖 Readability of changed filesAutomated Readability Index (ARI): a U.S. grade level. Lower is easier to read.
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance Benchmark (Lower is Faster)
|
| }; | ||
| }; | ||
| // The package root reaches its types through paths without an extension, which `nodenext` | ||
| // cannot resolve, so the types come from their own file. The prepare script inlines them. |
There was a problem hiding this comment.
looks bad, but it seems not in this pr
There was a problem hiding this comment.
I will add inside the cli-otel export, but it will be the separate PR.
| // UsageTelemetryEvent is one com.redocly.sdkUsage.aggregated CloudEvent: the counts | ||
| // of one operation in one window. Data holds the operation, then the SDK; their values | ||
| // are strings or int64. Time is the window start in RFC 3339 with milliseconds. The | ||
| // OpenTelemetry collector sets the env of the event. The json tags give a Sink that |
There was a problem hiding this comment.
This sentence is hard to read. Suggest: "The json tags make a Sink that marshals an event write the CloudEvent field names, as in the other languages."
There was a problem hiding this comment.
Done, with your wording.
…-event # Conflicts: # package-lock.json # packages/cli/package.json
What/Why/How?
The usage telemetry event of generated clients had its own shape:
datawas an object withusageandsdkmaps, so it did not follow the CloudEvent schema of the other Redocly CLI events in@redocly/cli-otel.The generated TypeScript, Python, Go, and PHP clients now send the
com.redocly.sdkUsage.aggregatedCloudEvent from@redocly/cli-otel0.4.0:dataholds the operation with its counts, then the SDK.@redocly/cli-otel, and the prepare script inlines that type into the runtime source.processCloudEventAttributesof@redocly/cli-otelgives for the event. The end-to-end test of each language compares them key by key, so a change of the event in a new@redocly/cli-otelfails the tests until the four runtimes follow.sinkreceives the new event, so a sink that readdata.usagemust read the first item ofdata. The changeset says so.Reference
Testing
Locally, unit and E2E tests. The events of generated TypeScript, Python, Go, and PHP clients were also sent to a local OpenTelemetry collector.
Screenshots (optional)
Check yourself
Security